﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditProductCtrl.ascx.cs" Inherits="WebUI.Controls.EditProductCtrl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<script type="text/javascript">
    function onIMEIAvailableChanged(cb) {
        if (cb.checked) {
            document.getElementById("<%=txtQuantity.ClientID %>").disabled = true;
            document.getElementById("<%=txtQuantity.ClientID %>").value = "";
        }
        else
            document.getElementById("<%=txtQuantity.ClientID %>").disabled = false;
    }

    function uploadPicture() {
        var hidPicture = document.getElementById("<%=hidPicture.ClientID %>");
        var hidThumbnail = document.getElementById("<%=hidThumbnail.ClientID %>");

        var fileNames = window.showModalDialog('Uploader.aspx?url=' + hidPicture.value, '', 'dialogWidth=640px;dialogHeight=480px;resizable=no;help=no;unadorned=yes;');

        if (fileNames != '' && fileNames != undefined) {
            var files = fileNames.split("|");
            hidThumbnail.value = files[0];
            hidPicture.value = files[1];
            document.getElementById("<%=btnPicture.ClientID %>").click();
        }
    }
</script>

<asp:Panel ID="mainPanel" runat="server" CssClass="primaryFrameNoBorder">
   <table width="100%">
        <tr>
            <td>
                <asp:Panel GroupingText="General Info" runat="server" ID="generalPanel" CssClass="editPanel">
                    <table width="100%">
                        <tr>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="lblname" runat="server" Text="Name:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Save" ID="require1" runat="server" ControlToValidate="txtName" Display="Dynamic" CssClass="requiredField"
                                    ErrorMessage="required" Text="required"></asp:RequiredFieldValidator>
                            </td>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label1" runat="server" Text="Category:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:DropDownList ID="ddlCategory" runat="server"></asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Save" ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlCategory" Display="Dynamic" CssClass="requiredField"
                                    ErrorMessage="required" Text="required"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label2" runat="server" Text="Description:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="3"></asp:TextBox>
                            </td>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label3" runat="server" Text="Brand:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:DropDownList ID="ddlBrand" runat="server"></asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Save" ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlBrand" Display="Dynamic" CssClass="requiredField"
                                    ErrorMessage="required" Text="required"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label4" runat="server" Text="Serial/IMEI:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top" colspan="2" >
                                <asp:CheckBox ID="chkIMEI" runat="server" onclick="onIMEIAvailableChanged(this);"  />
                                <div class='labelNote'>
                                    (*)If we intend to manage a product based <br />
                                    on IMEI number, we can not adjust quantity <br />directly. 
                                    The quantity number will be equal <br />to the count of
                                    IMEI(s) in stock.
                                </div>
                            </td>
                            <td style="text-align:left; vertical-align:top" rowspan="2">
                                <asp:UpdatePanel ID="updatePic" runat="server">
                                    <ContentTemplate>
                                        <asp:HyperLink ID="lnkPicture" runat="server" Target="_blank" ToolTip="Go to 'Products/Product Images' to upload images." >
                                            <asp:Image ID="imgPicture" runat="server" Width="100px" class='productThumb' AlternateText="No picture uploaded." />
                                        </asp:HyperLink>
                                        <br />
                                        
                                        <asp:HiddenField ID="hidPicture" runat="server" />
                                        <asp:HiddenField ID="hidThumbnail" runat="server" />
                                        <asp:Button style="display:none" ID="btnPicture" runat="server" OnClick="btnUploadFinish_OnClick" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label5" runat="server" Text="Bar Code:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox ID="txtBarCode" runat="server"></asp:TextBox><br />
                                <div style='height:4px'></div>
                                <div id="divBarCode" runat="server"></div>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Panel GroupingText="Inventory" runat="server" CssClass="editPanel">
                    <table>
                        <tr>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label7" runat="server" Text="Quantity:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtQuantity" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" TargetControlID="txtQuantity" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label14" runat="server" Text="Sold Quantity:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtSoldQuantity" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" TargetControlID="txtSoldQuantity" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label8" runat="server" Text="Cost:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtCost" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" TargetControlID="txtCost" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label9" runat="server" Text="Dealer Price:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtDealerPrice" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" TargetControlID="txtDealerPrice" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label10" runat="server" Text="Sale Price:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtSalePrice" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" TargetControlID="txtSalePrice" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label15" runat="server" Text="Partner Price:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtPartnerPrice" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" TargetControlID="txtPartnerPrice" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="Label11" runat="server" Text="GST:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:CheckBox ID="chkGST" runat="server" />
                            </td>
                           
                            <td style="text-align:right; vertical-align:top">
                                <asp:Label CssClass="labelMessage" ID="lblRegularPrice" runat="server" Text="Regular Price:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:TextBox onfocus="this.select();" ID="txtRegularPrice" runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender6" TargetControlID="txtRegularPrice" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Panel ID="panelExtra" GroupingText="Extra Information" runat="server" CssClass="editPanel">
                    <table>
                        <tr>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label12" runat="server" Text="Daily Special:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:CheckBox ID="chkHotProduct" runat="server" />
                            </td>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label17" runat="server" Text="New Arrival:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:CheckBox ID="chkNewArrival" runat="server" />
                            </td>
                        </tr>
                         <tr>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label6" runat="server" Text="Homepage Visible:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:CheckBox ID="chkHome" runat="server" />
                            </td>
                            <td style="text-align:right; vertical-align:top;width:120px;">
                                <asp:Label CssClass="labelMessage" ID="Label13" runat="server" Text="Dealer Only:"></asp:Label>
                            </td>
                            <td style="text-align:left; vertical-align:top">
                                <asp:CheckBox ID="chkDealerOnly" runat="server" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
   </table>
</asp:Panel>